package com.skyline.energy.dataaccess.jdbc;

import java.sql.Connection;

public class ConnectionHolder {
	private Connection currentConnection;
	private int counter = 0;

	public ConnectionHolder(Connection currentConnection) {
		this.currentConnection = currentConnection;
	}
	
	public Connection getCurrentConnection() {
		return currentConnection;
	}

	public void setCurrentConnection(Connection currentConnection) {
		this.currentConnection = currentConnection;
	}

	public void addCounter() {
		this.counter++;
	}
	
	public void reduceCounter() {
		this.counter--;
	}
	
	public boolean isOpen() {
		return (counter > 0);
	}
}
